<template>
    <h2>我是About的内容</h2>
</template>

<script>
    export default {
        name: 'About',
        /* beforeDestroy() {
            console.log('About组件即将被销毁了')
        },*/
        /* mounted() {
            console.log('About组件挂载完毕了',this)
            window.aboutRoute = this.$route
            window.aboutRouter = this.$router
        },  */
        //  通过路由规则进入该组件时调用
        beforeRouteEnter(to, from, next) {
            console.log('app===beforeRouteEnter')
            if (to.meta.isAuth) {
                if (localStorage.getItem('token') === '123') {
                    next()
                } else {
                    alert('无权限查看')
                }
            } else {
                next()
            }
        },
        //  通过路由规则离开该组件时调用
        beforeRouteLeave(to, from, next) {
            console.log('app===beforeRouteLeave', to, from)
            next()
        }
    }
</script>